package cn.bone.motan.jingzhouArea.web;

import cn.bone.motan.common.MoRequest;
import cn.bone.motan.common.MoResponse;
import cn.bone.motan.jingzhouArea.data.TempConfig;
import cn.bone.motan.jingzhouArea.server.RouteService;
import com.alibaba.fastjson.JSON;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by MD-01 on 2017/3/15.
 */
@RestController
@RequestMapping("/route")
public class RouteController {

    @Resource
    private RouteService routeService;

    @RequestMapping("/{sign}/query")
    public MoResponse route(@PathVariable("sign") String sign){

        System.out.println(sign);
        String result = JSON.toJSONString(TempConfig.me);
        MoRequest moRequest = new MoRequest();
        moRequest.setTo(sign);
        moRequest.setFrom("jzq.jz.hb.cn");
        moRequest.setMethod("route");
        return routeService.getRoutes(moRequest);
    }
}
